<template>
  <div class="">
    <el-table v-loading="listLoading" :data="list" size="small" element-loading-text="正在查询中..." border fit highlight-current-row>
      <el-table-column align="center" label="缓存名称" prop="name" width="300"/>
      <el-table-column align="center" label="状态" prop="status"/>
      <el-table-column align="center" label="数量" prop="size"/>
      <el-table-column align="center" label="获取平均时间" prop="averageGetTime"/>
      <el-table-column align="center" label="命中率" prop="hits"/>
      <el-table-column align="center" label="是否统计">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.statisticsEnabled" type="danger">是</el-tag>
          <el-tag v-else type="success">否</el-tag>
        </template>
      </el-table-column>
      <el-table-column align="center" label="内存大小(字节)" prop="memorySize"/>
      <el-table-column align="center" label="硬盘大小(字节)" prop="diskSize"/>
    </el-table>
  </div>
</template>

<script>
import { ConfigService } from '@/api/SystemService'

export default {
  name: 'Cache',
  data() {
    return {
      list: null, total: 0, listLoading: true
    }
  },
  created() {
    this.initList()
  },
  methods: {
    initList() {
      this.listLoading = true
      ConfigService.getCacheParams().then(result => {
        this.list = result
        this.listLoading = false
      })
    }
  }
}
</script>
